package gameFlow;

import java.util.Scanner;

import settings.gameInfo;
import settings.gameSettings;

public class Flow {

    protected String PLAYER_1;
    protected String PLAYER_2;
    Scanner sc = new Scanner(System.in);
    gameInfo gi = new gameInfo();
    gameSettings gs = new gameSettings();

    public void initializeGame() {
        sc.useDelimiter(System.getProperty("line.separator"));
        setPlayers();
        displaySettings();        
    }

    private void displaySettings(){
        System.out.println("\nSettings for this game are:");
        System.out.println("Life Points: " + gs.getLifePoints());
        System.out.println("Max number of cards in deck: " + gs.getDeckSize());
    }
    
    public void populateDecks(){
        
    }
    
    public String checkNullString(String nullString) {
        String text = nullString;
        while (text.length() == 0) {
            System.out.println("No Name was entered, please enter a Name:");
            text = sc.nextLine();
        }
        return text;
    }

    private void setPlayers() {
        String player1 = null;
        String player2 = null;
        System.out.println("Hello Players!");
        System.out.println("Lets Play " + gi.getGameName() + ":v" 
                + gi.getGameVersion() + " Created by MadDude97");

        System.out.print("What is player 1's name? ");
        player1 = checkNullString(sc.nextLine());

        System.out.print("What is player 2's name? ");
        player2 = checkNullString(sc.nextLine());

        setPlayer1(player1);
        setPlayer2(player2);

        System.out.println("\nToday's match up will be....");
        System.out.println("*** " + PLAYER_1 + " -VS- " + PLAYER_2 + " ***");
    }    

    private void setPlayer1(String playerName) {
        PLAYER_1 = playerName;
    }

    private void setPlayer2(String playerName) {
        PLAYER_2 = playerName;
    }
}
